//
//  SearchItemCell.m
//  NC-Trendy
//
//  Created by LeungChaos on 16/2/25.
//  Copyright © 2016年 liang. All rights reserved.
//

#import "SearchItemCell.h"

@interface SearchItemCell ()
@property (weak, nonatomic) IBOutlet UIImageView *itemImageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *descLab;
@property (weak, nonatomic) IBOutlet UILabel *typeLab;

@end

@implementation SearchItemCell

+ (id)searchCellWithTableView:(UITableView *)tableView {
    static NSString *iden = @"searchItemCell";
    SearchItemCell *cell = [tableView dequeueReusableCellWithIdentifier:iden];
    if (!cell) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"SearchItemCell" owner:nil options:nil]lastObject];
    }
    return cell;
}

- (void)setNcItem:(NCItem *)ncItem {
    _ncItem = ncItem;
    [self.itemImageView sd_setImageWithURL:[NSURL URLWithString:ncItem.item_image] placeholderImage:nil];
    self.titleLab.text = ncItem.item_title;
    self.descLab.text = ncItem.item_desc;
    [self setTypeLabWithTypeid:ncItem.item_type];
}

- (void)setTypeLabWithTypeid:(NSString *)type_id {
    switch ([type_id integerValue]) {
        case 0:
            self.typeLab.text = @"潮着";
            break;
        case 1:
            self.typeLab.text = @"明星";
            break;
        case 2:
            self.typeLab.text = @"数码";
            break;
        case 3:
            self.typeLab.text = @"美食";
            break;
        case 4:
            self.typeLab.text = @"文化";
            break;
    }
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
